﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Store.WP7.Controls;
using Store.WP7.ViewModels;

namespace Store.WP7.Views
{
    public partial class SettingsView : StoreApplicationPage
    {
        private SettingsViewModel _viewModel;

        public SettingsView()
        {
            InitializeComponent();

            Loaded += (s, e) =>
            {
                _viewModel = DataContext as SettingsViewModel;
            };
        }

        private void SignInButton_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
        {
            if (_viewModel != null && e.Error == null)
                _viewModel.SessionChanged(e.Session, e.Status);
        }
    }
}